<div ng-app="accountApp" ng-controller="accountAdressController">
    <div class="mainbox col-md-7 col-md-offset-2 col-sm-8 col-sm-offset-2">
        <?php if($message): ?>
        <div class="alert alert-success alert-dismissable">
            <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
            <?php print $message; ?>
        </div>       
        <?php endif; ?>
        <form  ng-submit="accountAdressProcess($event)" action="<?php print base_url() . 'user/account/' . $param;?>" method="post" enctype="multipart/form-data"  id="accountAdressForm" name="accountAdressForm" class="form-horizontal" role="form" novalidate>
            <div class="form-group" ng-class="{ 'has-error' : accountAdressForm.full_name.$error.required && submitted}">
                <label for="password" class="col-md-3">Họ tên</label>
                <div class="col-md-9">
                    <input type="text" class="form-control" name="full_name" value="<?php print @$data['address']['full_name'] ;?>" ng-model="accountAdress.full_name"  ng-init="accountAdress.full_name='<?php print @$data['address']['full_name'];?>'" required>
                    <p ng-show="submitted && accountAdressForm.full_name.$error.required" class="help-block">Họ tên không được để trống.</p>
                </div>
            </div>           
            
            <div class="form-group" ng-class="{ 'has-error' : accountAdressForm.fone.$error.required && submitted}">
                <label for="password" class="col-md-3">Số điện thoại</label>
                <div class="col-md-9">
                    <input type="text" class="form-control" name="fone" value="<?php print @$data['address']['fone'] ;?>" ng-model="accountAdress.fone"  ng-init="accountAdress.fone='<?php print @$data['address']['fone'];?>'" required>
                    <p ng-show="submitted && accountAdressForm.fone.$error.required" class="help-block">Số điện thoại không được để trống.</p>
                </div>
            </div>        
            
            <div class="form-group" ng-class="{ 'has-error' : accountAdressForm.address.$error.required && submitted}">
                <label for="password" class="col-md-3">Địa chỉ</label>
                <div class="col-md-9">
                    <input type="text" class="form-control" name="address" value="<?php print @$data['address']['address'] ;?>" ng-model="accountAdress.address"  ng-init="accountAdress.address='<?php print @$data['address']['address'];?>'" required>
                    <p ng-show="submitted && accountAdressForm.address.$error.required" class="help-block">Địa chỉ không được để trống.</p>
                </div>
            </div>    
            
            <div class="form-group" ng-class="{ 'has-error' : accountAdressForm.city.$error.required && submitted}">
                <label for="password" class="col-md-3">Tỉnh/Thành phố</label>
                <div class="col-md-9">
                    <select class="form-control" name="city" ng-model="accountAdress.city" ng-change="cityChanged()" ng-init="accountAdress.city=<?php print @$data['address']['city'];?>" required>
                        <option value="">Tỉnh/Thành phố</option>         
                        <?php foreach (@$data['city'] as $city): ?>
                        <option value="<?php print $city['id'];?>"><?php print $city['name'];?></option>                        
                        <?php endforeach; ?>
                    </select>                   
                    <p ng-show="submitted && accountAdressForm.city.$error.required" class="help-block">Tỉnh/Thành phố không được để trống.</p>
                </div>
            </div>
            
            <div class="form-group" ng-class="{ 'has-error' : accountAdressForm.district.$error.required && submitted}">
                <label for="password" class="col-md-3">Quận/Huyện</label>
                <div class="col-md-9">
                    <select class="form-control" name="district" id="district" ng-model="accountAdress.district" ng-init="accountAdress.district=<?php print @$data['address']['district'];?>" required>
                        <option value="">Quận/Huyện</option>                             
                        <?php foreach (@$data['district'] as $district): ?>
                        <option value="<?php print $district['id'];?>"><?php print $district['name'];?></option>                        
                        <?php endforeach; ?>
                        <!--<option ng-repeat="district in districts" value="{{district.id}}" >{{ district.name }}</option> -->
                    </select>                   
                    <p ng-show="submitted && accountAdressForm.district.$error.required" class="help-block">Quận/Huyện không được để trống.</p>
                </div>
            </div>
           
            
            <div style="margin-top:10px" class="form-group">               
                <div class="col-sm-12 controls">
                    <div class="form-group">
                        <!-- Button -->                                        
                        <div class="col-md-offset-3 col-md-9">
                            <button ng-disabled="loadingTracker.active()" id="btn-signup" type="submit" class="btn btn-info" data-style="zoom-in">
                                <span class="ladda-label">{{textButton}}</span>                                               
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        </form>     
    </div>
</div>